package com.jingdianjichi.subject.infra.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisConfiguration {

    /**
     * @Description: 重新封装了MybatisPlusInterceptor拦截器，
     *              里面重新实现了InnerInterceptor接口，可以将执行sql语句更清晰的打印在控制台
     *              比 mybatis-plus默认提供的更清晰，且会自动填充好 占位符
     * @return:
     * @Author:  sky
     * @date:  2024/11/9 0:04
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new MybatisPlusAllSqlLog());
        return mybatisPlusInterceptor;
    }


}
